#pragma once

#include "Control.h"

namespace My {

class Container : 
	public virtual Control
{
	friend class Control;
protected:
	ControlList		m_Controls;
	Control *		m_pHoverControl;
protected:
	virtual Control * GetHoverControl(CPoint p);
	void PaintChild(CDC * pDC, const CRect & r, Control * pChild);
	virtual void Paint(CDC * pDC, const CRect & r);
	virtual Control * GetCaptureControl() const;
	virtual Control * GetFocusControl() const;
	virtual void SetCaptureControl(Control * pControl);
	virtual void SetFocusControl(Control * pControl);
public:
	Container();
	~Container();
public:
	void Add(Control * pControl);
	void Remove(Control * pControl);
	void ToFront(Control * pControl);
	virtual void ProcessEvent(Event & e);
	void DispatchEvent(Event &);
	virtual void UpdateBounds();
	virtual void UpdateVisible();
	virtual void LayoutControls() { }
};

} // My
